package com.gdkj.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum RoomTypeEnums {
    // 房间类型 1 你画我猜 2 群聊派对 3 一起K歌 4 谁是卧底 5 开黑游戏类 999 聊天匹配
    DRAW_GUSS(1, "你画我猜"),
    GROUP_CHAT_PARTY(2, "群聊派对"),
    KTV(3, "一起K歌"),
    WOLF_PERSON_KILL(4, "狼人杀"),
    GoBang(5,"五子棋"),
    Checkers(6, "国际跳棋"),
    GO_BANG_SMART(7,"五子棋人机版"),
    SWEEP_THUNDER(8, "扫雷大作战"),
    NUMBER_BOMB(9, "数字炸弹"),
    FIND_FAULT_TOGETHER(10, "一起来找茬"),
    THROW_DARTS(11, "飞镖达人"),
    CLEAR(12, "一起消消乐"),

    FLY_CHECKERS_TWO(13,"Ludo2人局"),
    FLY_CHECKERS_MANNY(14,"Ludo4人局"),
    FLY_CHECKERS_FOUR(15,"Ludo2V2"),
    FLY_CHECKERS_SMART(16,"Ludo人机"),

    CHAT_MATCH(999,"聊天匹配"),
    H5_JUMP(1000, "h5跳转"),
    STAR_DIG(1001, "星球探索"),
    SIMPLE_GAME(1002, "单机游戏");

    private Integer type;

    private String name;

    RoomTypeEnums(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public static String partyKey(Integer type){
        switch (type){
            case 1: return "M";
            case 2: return "K";
            case 3: return "L";
            case 4: return "M";
            case 5: return "M";
            case 6: return "M";
            case 7: return "M";
            case 8: return "M";
            case 9: return "M";
//            case 4: return "M";
//            case 5: return "K";
            default: return "*";
        }
    }

    /**
     * 枚举类型转HashMap
     */
    public static List<HashMap<String, Object>> StatusEnum() {
        List<HashMap<String, Object>> result = new ArrayList<>();

        RoomTypeEnums[] values = RoomTypeEnums.values();
        for (RoomTypeEnums status : values) {
            if(status.getType()<17 && status.getType() != 15){
                HashMap<String, Object> map = new HashMap<>();
                map.put("typeName", status.getName());
                map.put("typeId", status.getType());
                result.add(map); 
            }
        }
        return result;
    }

    /**
    * 根据id获取配置
    */
    public static String getDesByCode(Integer code) {

        for (RoomTypeEnums typeEnum : RoomTypeEnums.values()) {
            if (typeEnum.getType().equals(code)) {
                return typeEnum.getName();
            }
        }

        return "";
    }

    /**
    * 是否是游戏数据
    */
    /**
     * 是否是游戏数据
     */
    public static boolean isGameRoom(Integer roomType) {
        if (roomType.equals(RoomTypeEnums.DRAW_GUSS.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.WOLF_PERSON_KILL.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.GoBang.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.Checkers.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.SWEEP_THUNDER.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.NUMBER_BOMB.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.FIND_FAULT_TOGETHER.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.THROW_DARTS.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.CLEAR.getType())){
            return true;
        }
        return false;
    }

    /**
    * 是否是飞行棋
    **/
    public static boolean isFlyGame(Integer roomType) {
        if (roomType.equals(RoomTypeEnums.FLY_CHECKERS_TWO.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.FLY_CHECKERS_MANNY.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.FLY_CHECKERS_FOUR.getType())){
            return true;
        }
        if (roomType.equals(RoomTypeEnums.FLY_CHECKERS_SMART.getType())){
            return true;
        }
        return false;
    }


    public static boolean needFilterXinJiang(Integer roomType) {
        List<Integer> filter = new ArrayList<>();
        filter.add(FLY_CHECKERS_TWO.getType());
        filter.add(FLY_CHECKERS_MANNY.getType());
        filter.add(FLY_CHECKERS_FOUR.getType());
        filter.add(FLY_CHECKERS_SMART.getType());
        if (filter.contains(roomType)){
            return true;
        }
        return false;
    }


    /**
     * 麦位数量
     */
    public static final Map<Integer, Integer> MIKE_COUNT_MAP = new HashMap<Integer, Integer>(){
        {
            put(RoomTypeEnums.DRAW_GUSS.getType(), 6);
            put(RoomTypeEnums.GROUP_CHAT_PARTY.getType(), 8);
            put(RoomTypeEnums.KTV.getType(), 6);
            put(RoomTypeEnums.WOLF_PERSON_KILL.getType(), 9);
            put(RoomTypeEnums.GoBang.getType(), 2);
            put(RoomTypeEnums.Checkers.getType(), 2);
            put(RoomTypeEnums.GO_BANG_SMART.getType(), 2);
            put(RoomTypeEnums.SWEEP_THUNDER.getType(), 6);
            put(RoomTypeEnums.NUMBER_BOMB.getType(), 6);
            put(RoomTypeEnums.FIND_FAULT_TOGETHER.getType(), 2);
            put(RoomTypeEnums.THROW_DARTS.getType(), 2);
            put(RoomTypeEnums.CLEAR.getType(), 2);
            put(RoomTypeEnums.FLY_CHECKERS_TWO.getType(),2);
            put(RoomTypeEnums.FLY_CHECKERS_MANNY.getType(),4);
            put(RoomTypeEnums.FLY_CHECKERS_FOUR.getType(),4);
            put(RoomTypeEnums.FLY_CHECKERS_SMART.getType(),4);
        }
    };
}
